package handler

import (
	"cine-dev/model"
	"github.com/gin-gonic/gin"
)

func Video(c *gin.Context) {
	title := c.PostForm("title")
	time := c.PostForm("time")
	comment := c.PostForm("comment")
	data := model.Video{
		Title:   title,
		Time:    time,
		Comment: comment,
	}
	model.DB.Create(&data)
	c.JSON(200, gin.H{
		"code": 200,
		"msg":  "OK",
	})
	return
}
func List(c *gin.Context) {
	var video []model.Video
	model.DB.Find(&video)
	c.JSON(200, gin.H{
		"code": 200,
		"msg":  "OK",
		"data": video,
	})
}
